﻿//Author:Michal Sporna
//License: https://operationsneakpeek.codeplex.com/license

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Levels
{
    /// <summary>
    /// requirement to complete level
    /// </summary>
    public class Requirement
    {
        #region properties
        public string Description { get; set; } //eg: find 8 bricks of cocaine to complete this level!
        public Util.Helpers.PublicEnums.EntityType EntityType { get; set; } //what entity this requirements concerns
        public string EntityID { get; set; }
        public Util.Helpers.PublicEnums.RequirementAction RequiredAction { get; set; } //what needs to be done to the entity
        public int value { get; set; } //how many of entities need to be affected by the required action
        #endregion


        #region public fields
        //helpers
        public string EntityTypeString;
        public string RequiredActionString;


        #endregion


        #region methods and functions

        /// <summary>
        /// Converts helper values( like Entity type string)
        /// to properties such as publicEnums.EntityType
        /// </summary>
        public void ConvertHelpersToValues()
        {
            try
            {
                #region entity type
                //Bomb, Item, NPC
                switch (EntityTypeString)
                {
                    case "Bomb":
                        {
                            this.EntityType = Util.Helpers.PublicEnums.EntityType.Bomb;
                            break;
                        }
                    case "Item":
                        {

                            this.EntityType = Util.Helpers.PublicEnums.EntityType.Item;
                            break;
                        }
                    case "NPC":
                        {
                            this.EntityType = Util.Helpers.PublicEnums.EntityType.NPC;

                            break;
                        }
                }


                #endregion

                #region parse required action

                //Defuse, DefuseDouble, DefuseTriple, DefuseFour, Collect, Knockout,KnockoutLow, KnockoutMedium, Time
                switch (RequiredActionString)
                {
                    case "Defuse":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.Defuse;

                            break;
                        }
                    case "DefuseDouble":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.DefuseDouble;

                            break;


                        }
                    case "DefuseTriple":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.DefuseTriple;

                            break;


                        }
                    case "DefuseFour":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.DefuseFour;

                            break;
                        }
                    case "Collect":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.Collect;

                            break;


                        }
                    case "Knockout":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.Knockout;

                            break;


                        }
                    case "KnockoutLow":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.KnockoutLow;

                            break;


                        }
                    case "KnockoutMedium":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.KnockoutMedium;

                            break;


                        }
                    case "Time":
                        {
                            this.RequiredAction = Util.Helpers.PublicEnums.RequirementAction.Time;

                            break;


                        }

                      
                }



                #endregion




            }
            catch (Exception ex)
            {
                Util.ErrorLogging.LogError(ex);
                return;
            }
        }





        #endregion

    }
}
